package com.fypg.module.blooddonation.api.controller.app.bloodDonation;

import com.fypg.framework.common.pojo.CommonResult;
import com.fypg.module.blooddonation.api.client.dal.bloodPlatform.DonRecordQueryReq;
import com.fypg.module.blooddonation.api.client.dal.bloodPlatform.DonchkTestResultsResp;
import com.fypg.module.blooddonation.api.client.dal.bloodPlatform.DonorChkData;
import com.fypg.module.blooddonation.api.client.dal.bloodPlatform.DonorChkReq;
import com.fypg.module.blooddonation.api.client.dal.bloodStation.AppointmentResultData;
import com.fypg.module.blooddonation.api.client.dal.bloodStation.BloodAppReq;
import com.fypg.module.blooddonation.api.client.dal.bloodStation.GetBloodAppReq;
import com.fypg.module.blooddonation.api.client.service.bloodDonationAPI.BloodDonationAPIService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/blood/temp")
@RequiredArgsConstructor
@Validated
@Tag(name = "临时接口")
public class TempController {
    private final BloodDonationAPIService bloodDonationAPIService;;
    @PostMapping("/test")
    @Operation(summary = "献血记录")
    public CommonResult<DonchkTestResultsResp> getDictionaryTypeList(@Valid @RequestBody DonRecordQueryReq request) {
        DonchkTestResultsResp donchkTestResultsResp = bloodDonationAPIService.donchkTestResults(request);
        return CommonResult.success(donchkTestResultsResp);
    }

    @PostMapping("/example")
    @Operation(summary = "献血核查")
    public CommonResult<DonorChkData> getDictionaryTypeList(@Valid @RequestBody DonorChkReq request) {
        DonorChkData donchkTestResultsResp = bloodDonationAPIService.donorCheck(request);
        return CommonResult.success(donchkTestResultsResp);
    }
    @PostMapping("/token")
    @Operation(summary = "获取token")
    public CommonResult<String> getToken(String bloodStationEncode) {
        java.lang.String token = bloodDonationAPIService.getToken(bloodStationEncode);
        return CommonResult.success(token);
    }
    @PostMapping("/getBloodApp")
    @Operation(summary = "预约结果查询")
    public CommonResult<AppointmentResultData> getBloodApp(@Valid @RequestBody GetBloodAppReq request) {
        AppointmentResultData bloodApp = bloodDonationAPIService.getBloodApp(request);
        return CommonResult.success(bloodApp);
    }
    @PostMapping("/bloodApp")
    @Operation(summary = "预约结果查询")
    public CommonResult<String> bloodApp(@Valid @RequestBody BloodAppReq request) {
        String encode = bloodDonationAPIService.bloodApp(request);
        return CommonResult.success(encode);
    }
}
